]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
accessDialog: Don't add an empty body
authorAlessandro Bono <alessandro.bono369@gmail.com>
Mon, 16 Jan 2023 20:41:24 +0000 (21:41 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 17 Jan 2023 13:51:54 +0000 (13:51 +0000)
According to the org.freedesktop.impl.portal.Access documentation
the body may be an empty string[1]. Take into account this case.

[1] https://github.com/flatpak/xdg-desktop-portal/blob/d7cfc16a6dc11cb925116fe36c5ee23e7075849c/data/org.freedesktop.impl.portal.Access.xml#L38

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2607>

js/ui/accessDialog.js

index fba2521fd740f5d39913abfea537218888df0fba..1e296079c54867fdca829ddfb5b88efaaba23c12 100644 (file)
@@ -58,13 +58,15 @@ class AccessDialog extends ModalDialog.ModalDialog {
             this._choices.set(id, check);
         }
 
-        let bodyLabel = new St.Label({
-            text: body,
-            x_align: Clutter.ActorAlign.CENTER,
-        });
-        bodyLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
-        bodyLabel.clutter_text.line_wrap = true;
-        content.add_child(bodyLabel);
+        if (body) {
+            let bodyLabel = new St.Label({
+                text: body,
+                x_align: Clutter.ActorAlign.CENTER,
+            });
+            bodyLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
+            bodyLabel.clutter_text.line_wrap = true;
+            content.add_child(bodyLabel);
+        }
 
         this.addButton({
             label: denyLabel,